using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;

public class UIMain : UIBasePanel
{

    public Label Lab_Life;//剩余寿命
    public Label Lab_Money;
    public Button Btn_Bag;
    public Button Btn_Map;
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {

    }

    public void Init()
    {
        Lab_Life = GameObject.Find("Lab_Life").GetComponent<Label>();
        Lab_Money = GameObject.Find("Lab_Money").GetComponent<Label>(); ;
        Btn_Bag = GameObject.Find("Btn_Bag").GetComponent<Button>();
        Lab_Life.text = GameData.PlayerInfo.Life + "年";
        Lab_Money.text = GameData.Money + "灵石";
        Btn_Map = GameObject.Find("Btn_Map").GetComponent<Button>();
        Btn_Bag.clicked += (() =>
        {
            UIManager.instance.Open<UIBag>();
        });

    }
    void OnDestroy()
    {

    }

    public void OnMoneyChange()
    {
        Lab_Money.text = GameData.Money + "灵石";
    }

    public void OnLifeChange()
    {
        Lab_Life.text = GameData.PlayerInfo.Life + "年";
    }

}

